package com.fengba.nanzhi.tabbar01;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.webkit.JavascriptInterface;

import com.fengba.nanzhi.tabbar03.GoodInfo;
import com.fengba.nanzhi.tabbar03.SubmitOrder;

// 继承自Object类
public class AndroidtoJs extends Activity {
    private Context context;

    public AndroidtoJs(Context context){
        this.context = context;
    }

    public AndroidtoJs(Func1 test){
    }

    // 定义JS需要调用的方法
    // 被JS调用的方法必须加入@JavascriptInterface注解
    @JavascriptInterface
    public void shop(String msg) {
        //System.out.println(msg);
        String good = msg;
        Intent intent = new Intent(context, SubmitOrder.class);
        intent.putExtra("good", good.toString());
        startActivity(intent);
    }

    interface Func1{
        void onResponse(String result);
    }
}